package org.vineatoum.view.utils;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.TransferHandler;
import javax.swing.TransferHandler.TransferSupport;
import javax.swing.tree.DefaultMutableTreeNode;

import org.vineatoum.business.state.Benne;
import org.vineatoum.business.state.abstraction.VinAbstract;

public class PlantationListTransferHandler extends TransferHandler {


	@Override
	protected Transferable createTransferable(JComponent c) {
		try{
			JList list = (JList) c;
		
		System.out.println(this);
		Object vin = list.getSelectedValue();
		System.out.println(vin);
		if (vin instanceof VinAbstract) {
			return new TransferableVinAbstract((VinAbstract) vin);
		}
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;

	}

	@Override
	public int getSourceActions(JComponent c) {
		return COPY;
	}
}
